package cc.customer.authorization;

/**
 * 相关常量
 * @author Wang
 */
public class Constants {

    /**
     * 存储在Request中的当前登录用户id的名称
     */
    public static final String CURRENT_USER_ID = "CURRENT_USER_ID";

    /**
     * token在Redis中缓存的有效期（小时）
     */
    public static final int TOKEN_EXPIRES_HOURS = 72;
    
    /**
     * token在Redis中缓存的名称前缀
     */
    public static final String REDIS_TOKEN_PREX = "api_authorization_token:";
    
    /**
     * timestamp时间戳过期时间（分钟）
     */
    public static final int TIMESTAMP_EXPIRES_MINS = 10;
    
    /**
     * 当前登陆用户在Session中的名称
     */
    public static String currentUserSessionName = "currentUser";
    
    /**
     * 返回描述信息
     */
    public static final String MESSAGE = "message";
    
    /**
     * 返回状态码
     */
    public static final String CODE = "code";
    
    /**
     * 状态码失败
     */
    public static final String CODE_FAILE = "0";
    
    /**
     * 状态码成功
     */
    public static final String CODE_SUCCESS = "1";

    /**
     * 状态码成功
     */
    public static final String CODE_UNAUTHORIZED = "2";
    
    /**
     * 状态码服务器内部错误
     */
    public static final String CODE_INTERNAL_SERVER_ERROR = "3";
    
    /**
     * 状态码服务器路径未找到
     */
    public static final String CODE_NOT_FOUND = "4";
    
    /**
     * 状态码超时
     */
    public static final String CODE_TIMEOUT = "5";
    
    
    /**
     * 账号错误
     */
    public static final String CODE_USERNAME = "6";
    
    
    /**
     * 密码错误
     */
    public static final String CODE_PASSWORD = "7";
    
    /**
     * 手机号正则
     * */
    public static final String REGEX_MOBILE_EXACT  = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(16[6])|(17[0,1,3,5-8])|(18[0-9])|(19[8,9]))\\d{8}$";
    
    /**
     * 用户名正则
     * <p>scope for "a-z", "A-Z", "0-9", "_", "Chinese character"</p>
     * <p>can't end with "_"</p>
     * <p>length is between 6 to 20</p>
     */
    public static final String REGEX_USERNAME = "^[\\w\\u4e00-\\u9fa5]{6,20}(?<!_)$";

    /**
     * 用户名正则.
     * <p>scope for "a-z", "A-Z", "0-9", "_", "Chinese character"</p>
     * <p>length is between 6 to 20</p>
     */
    public static final String REGEX_PASSWORD = "^[a-zA-Z]w{5,17}$";
    
    
    
    /**
     * 邮箱正则.
     */
    public static final String REGEX_EMAIL = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
}
